package com.javasm.crm.mapper.giftmapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.javasm.crm.domin.entity.gift.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author smf
 * @since 2021-07-12
 */
@Mapper
@Repository
public interface GiftInfoMapper extends BaseMapper<GiftInfo> {
	@Select("select g.*,pt.type_id typeId,pt.type_name typeName,pb.brand_id brandId,pb.brand_name brandName,pc.color_name colorName,pc.color_id colorId from Gift_Info g inner join product_type pt on g.gift_typeid=pt.type_id inner join product_brand pb on pb.brand_id=g.gift_brandid inner join product_color pc on g.gift_colorid=pc.color_id"+" ${ew.customSqlSegment}")
	List<GiftVo> queryall(Page<GiftVo> pagination, @Param(Constants.WRAPPER) QueryWrapper<GiftVo> exampleQueryWrapper);

	@Select("select * from product_color")
	List<GiftColor> queryColor();

	@Select("select * from product_type")
	List<GiftType> queryType();

	@Select("select * from product_brand")
	List<GiftBrand> queryBrand();

/*	@Select("update gift_info set gift_sum =")
	int removeById(GiftInfo giftInfo);*/

}
